{extend name="layout/detail" /}
{block name="content"}
<div class="layui-tab">
    <ul class="layui-tab-title">
        <li onclick="user_index();">人才管理</li>
        <li onclick="role_index()">角色管理</li>
        <li class="layui-this" onclick="dept_index()">组织管理</li>
    </ul>
</div>
<div class="panel no-border">
    <div id="adv_search">
        <form id="form_adv_search" class="layui-form" method="post">
            <div class="layui-input-inline w22">
                <input class="layui-input" name="li_name" placeholder="请输入姓名/手机号搜索">
                <a class="add-on"><i class="fa fa-search"></i></a>
            </div>
        </form>
    </div>
    <span class="mid"></span>
    <a class="layui-btn" onclick="add();">添加</a>
</div>
<table class="layui-table" lay-skin="line">
    <colgroup>
        <col width="150">
        <col width="250">
        <col width="300">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>名称</th>
        <th>备注</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {volist name="vo_list" id="vo"}
    <tr>
        <td>{$vo.name}</td>
        <td>{$vo.remark}</td>
        <td><a class="layui-btn layui-btn-xs" onclick="edit({$vo.id})">编辑</a><a
                class="layui-btn layui-btn-danger layui-btn-xs" onclick="del({$vo['id']})">删除</a></td>
    </tr>
    {/volist}
    </tbody>
</table>
{/block}

{block name="script"}
<script>
    layui.use(['element'], function () {
        $ = layui.jquery;

        set_return_url(null);
        var fn = {
            user_index: function () {
                window.open('{:url("User/index")}', '_self');
            },
            role_index: function () {
                window.open('{:url("Role/index")}', '_self');
            },
            dept_index: function () {
                window.open('{:url("Dept/index")}', '_self');
            },
            add: function () {
                window.open('{:url("add")}', '_self');
            },
            edit: function (id) {
                window.open("{:url('edit')}?id=" + id, '_self');
            },
            del: function (id) {
                layer.msg('确定要删除吗?', {
                    time: 0,
                    btn: ['确定', '取消'],
                    yes: function (index) {
                        var vars = 'id=' + id;
                        $.get("{:url('del')}", vars, function (ret) {
                            if (ret.code) {
                                layer.msg(ret.msg, {
                                    time: 1200
                                }, function () {
                                    location.reload(true);
                                });
                            }
                        });
                    },
                    no: function (index) {
                        layer.close(index);
                    }
                });
            },
        };
        win_exp(fn);
    });
</script>
{/block}